package com.example.springboot.enums;

import java.util.Objects;

public enum ServiceEnum {
    SERVICE1("SERVICE1","服务1",1),
    SERVICE2("SERVICE2","服务2",2),
    SERVICE3("SERVICE3","服务3",3),
    SERVICE4("SERVICE4","服务4",4);

    String name;
    String desc;
    int code;

    ServiceEnum(String name, String desc, int code) {
        this.name = name;
        this.desc = desc;
        this.code = code;
    }

    public static ServiceEnum findBy(String name) {
        for (ServiceEnum serviceEnum : ServiceEnum.values()) {
            if (Objects.equals(name, serviceEnum.getName())) {
                return serviceEnum;
            }
        }
        return null;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public String getDesc() {
        return desc;
    }

    public int getCode() {
        return code;
    }
}
